package com.itheima.demo001;

public class GoodsTest {
    public static void main(String[] args) {
        //1.创建一个数组
        Goods[] arr = new Goods[3];

        //2.创建三个商品对象
        Goods g1 = new Goods("001","漫画，名侦探柯南",1800.0,600);
        Goods g2 = new Goods("002","漫画，火影忍者",1900.0,800);
        Goods g3 = new Goods("003","漫画，海贼王",2000.0,1000);

        //3.把商品添加到数组中
        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;

        //4.遍历
        for (int i = 0; i < arr.length; i++) {
            //i索引 arr[i]元素
            Goods goods = arr[i];
            System.out.println(goods.getId() + "," + goods.getName() + "," + goods.getPrice() + "," + goods.getCount());
        }
    }
}
